import Vue from 'vue';
import Antd from 'ant-design-vue';
import App from './App';
import 'ant-design-vue/dist/antd.css';
import VueRouter from 'vue-router'
import Index from './layout/Index'
import Forum from './layout/Forum'
import ChessManual from './layout/ChessManual'
import Videos from './layout/Videos'
import Game from './layout/Game'
import My from './layout/My'
import News from './layout/News'
import VideosDetail from './layout/VideosDetail'
import VideosList from './layout/VideosList'
import ForumDetail from './layout/ForumDetail'
import NewsDetail from './layout/NewsDetail'
import MyCourse from './layout/personal/MyCourse'
import MyArticleCollection from './layout/personal/MyArticleCollection'
import MyChessManual from './layout/personal/MyChessManual'
import MyCourseCollection from './layout/personal/MyCourseCollection'
import MyDynamic from './layout/personal/MyDynamic'
import MyFocus from './layout/personal/MyFocus'
import MyMessage from './layout/personal/MyMessage'
import MySetting from './layout/personal/MySetting'
Vue.config.productionTip = false;
Vue.use(VueRouter);
Vue.use(Antd);

/* eslint-disable no-new */
// new Vue({
//     el: '#app',
//     components: { App },
//     template: '<App/>',
// });
let router = new VueRouter({
    mode: 'history',
    routes: [
        {
            path: '/',
            component: Index,
            name: 'index'
        },
        {
            path: '/index',
            component: Index,
            name: 'index'
        },
        {
            path: '*',
            component: Index,
            name: 'index'
        },
        {
            path: '/my',
            component: My,
            name: 'my',
            children: [
                {
                    path: 'my_setting',//以“/”开头的嵌套路径会被当作根路径，所以子路由上不用加“/”;在生成路由时，主路由上的path会被自动添加到子路由之前，所以子路由上的path不用在重新声明主路由上的path了。
                    name: 'my_setting',
                    component: MySetting
                },
                {
                    path: 'my_message',
                    name: 'my_message',
                    component: MyMessage
                },
                {
                    path: 'my_focus',
                    name: 'my_focus',
                    component: MyFocus
                },
                {
                    path: 'my_dynamic',
                    name: 'my_dynamic',
                    component: MyDynamic
                },
                {
                    path: 'my_course_collection',
                    name: 'my_course_collection',
                    component: MyCourseCollection
                },
                {
                    path: 'my_chess_manual',
                    name: 'my_chess_manual',
                    component: MyChessManual
                },
                {
                    path: 'my_article_collection',
                    name: 'my_article_collection',
                    component: MyArticleCollection
                },
                {
                    path: 'my_course',
                    name: 'my_course',
                    component: MyCourse
                }
            ]
        },
        {
            path: '/game',
            component: Game,
            name: 'game'
        },
        {
            path: '/videos',
            component: Videos,
            name: 'videos'
        },
        {
            path: '/chess_manual',
            component: ChessManual,
            name: 'chess_manual'
        },
        {
            path: '/forum',
            component: Forum,
            name: 'forum'
        },
        {
            path: '/news',
            component: News,
            name: 'news'
        },{
            path: '/videos_detail',
            component: VideosDetail,
            name: 'videos_detail'
        },{
            path: '/videos_list',
            component: VideosList,
            name: 'videos_list'
        },{
            path: '/forum_detail',
            component: ForumDetail,
            name: 'forum_detail'
        },{
            path: '/news_detail',
            component: NewsDetail,
            name: 'news_detail'
        }
    ]
})
new Vue({
  render: h => h(App),
    router
}).$mount('#app')

export default router;